icon theme: Don't add profiler marks for short async icon loads
authorAlexander Larsson <alexl@redhat.com>
Wed, 12 Feb 2020 11:43:27 +0000 (12:43 +0100)
committerAlexander Larsson <alexl@redhat.com>
Wed, 12 Feb 2020 11:43:27 +0000 (12:43 +0100)
We do a bunch of preloads, and most of these are not really interesting
anyway.

gtk/gtkicontheme.c

index 3151d3b31691551fab227c5a7ff31d05827090c0..5c1f2dc22c6c4f90167ed6a75dc51d7bc22ae4e7 100644 (file)
@@ -3606,8 +3606,13 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
   g_assert (icon->texture != NULL);
 
   if (GDK_PROFILER_IS_RUNNING)
-    gdk_profiler_end_markf (before, in_thread ?  "icon load (thread)" : "icon load" ,
-                            "%s size %d@%d", icon->filename, icon->desired_size, icon->desired_scale);
+    {
+      guint64 end = g_get_monotonic_time ();
+      /* Don't report quick (< 0.5 msec) parses */
+      if (end - before > 500 || !in_thread)
+        gdk_profiler_add_markf (before, (end - before), in_thread ?  "icon load (thread)" : "icon load" ,
+                                "%s size %d@%d", icon->filename, icon->desired_size, icon->desired_scale);
+    }
 }
 
 static GdkTexture *